package com.coolxiaoyao.test.controller;

import com.coolxiaoyao.common.annotation.GetMapping;
import com.coolxiaoyao.common.annotation.RestController;
import com.coolxiaoyao.web.http.HttpEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

/**
 * @author Kerry on 18/09/30
 */

@RestController
public class DownloadController {

    private static Logger logger = LoggerFactory.getLogger(DownloadController.class);

    @GetMapping("/")
    public Object index() {
        Map<String, Object> objectObjectMap = new HashMap<>();
        objectObjectMap.put("key", "1");
        objectObjectMap.put("k3ey", "1");
        return objectObjectMap;
    }

    @GetMapping("/download")
    public HttpEntity<File> donwload() {


        File file = new File("E:\\BaiduNetdiskDownload\\金秘书为何这样\\[TSKS][Why.Secretary.Kim][E005(720P)][KO_CN].mkv");
        logger.info("download file : {}", file);
        return new HttpEntity<>(file);
    }

}
